from flask import Flask,request,render_template
from mar30.pcUtils import *
app = Flask(__name__)


@app.route("/")
def index():
    return render_template('index.html')

@app.route("/login",methods=['POST','GET'])
def login():
    username = request.form['username']
    print(username)
    userpwd = request.form['userpwd']
    if username=='11':
        if userpwd=='11':
            return render_template('pc.html')
        else:
            return "密码错误"
    else:
        return "对不起，当前用户不存在！"
@app.route("/scrawl",methods=['POST','GET'])
def scrawl():
    name = request.form['name']
    url = request.form['targeturl']
    #增加一个爬虫的业务
    s = Scrawler()
    targetText = s.getTargetText(url,selector='p')
    return targetText
    #s.getTargetImg
if __name__=="__main__":
    app.run()